﻿using Microsoft.Cloud.API.Azure.Services;
using System.Threading.Tasks;
using System.Web.Http;

namespace Microsoft.Cloud.API.Azure.Controllers
{
    public class LocationsController : ApiController
    {
        /// <summary>
        /// get locations
        /// </summary>
        /// <param name="subscriptionId"></param>
        /// <returns></returns>
        public async Task<IHttpActionResult> Get(string subscriptionId)
        {
            using (var managementService = new ManagementService(subscriptionId))
            {
                var result = await managementService.GetLocationListAsync();

                return Ok(result);
            }
        }
    }
}
